package com.springcloud.learn.refactor;

import com.springcloud.learn.HelloServiceApi;
import com.springcloud.learn.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/11/8.
 */
@RestController
public class RefactorHelloController implements HelloServiceApi {
    @Override
    public String hello4(@RequestParam("name") String name) {
        return "hello  "+name;
    }

    @Override
    public User hello5(@RequestHeader("name") String name, @RequestHeader("age") Integer age) {
        return new User(name,age);
    }

    @Override
    public String hello6(@RequestBody User user) {
        return "hello  "+user.getName()+", "+user.getAge();
    }
}
